﻿CREATE TABLE [v1].[Account] (
    [AccountId]                   INT            DEFAULT ((-1)) NOT NULL,
    [AccountCode]                 VARCHAR (8)    DEFAULT ('UNK') NULL,
    [AccountType]                 NVARCHAR (100) DEFAULT ('Unknown') NULL,
    [AccountName]                 NVARCHAR (100) DEFAULT ('Unknown') NULL,
    [AccountOrderBy]              INT            DEFAULT ((2147483647)) NOT NULL,
    [IsLatest]                    BIT            DEFAULT ((1)) NOT NULL,
    [IsDeleted]                   BIT            DEFAULT ((0)) NOT NULL,
    [GLTypeId]                    INT            DEFAULT ((-1)) NOT NULL,
    [GLTypeCode]                  VARCHAR (8)    DEFAULT ('UNK') NULL,
    [GLTypeName]                  NVARCHAR (100) DEFAULT ('Unknown') NULL,
    [GLTypeOrderBy]               INT            DEFAULT ((2147483647)) NOT NULL,
    [GLSubTypeId]                 INT            NULL,
    [GLSubTypeCode]               VARCHAR (8)    NULL,
    [GLSubTypeName]               NVARCHAR (100) NULL,
    [GLSubTypeOrderBy]            INT            DEFAULT ((2147483647)) NULL,
    [GLAccountId]                 INT            NULL,
    [GLAccountCode]               VARCHAR (8)    NULL,
    [GLAccountName]               NVARCHAR (100) NULL,
    [GLAccountOrderBy]            INT            DEFAULT ((2147483647)) NULL,
    [TotalCostDetailId]           INT            NULL,
    [TotalCostDetailCode]         VARCHAR (8)    NULL,
    [TotalCostDetailName]         NVARCHAR (100) NULL,
    [TotalCostDetailOrderBy]      INT            DEFAULT ((2147483647)) NULL,
    [ExpenseTypeId]               INT            NULL,
    [ExpenseTypeCode]             VARCHAR (8)    NULL,
    [ExpenseTypeName]             NVARCHAR (100) NULL,
    [ExpenseTypeOrderBy]          INT            DEFAULT ((2147483647)) NULL,
    [ExpenseTypeDetailId]         INT            NULL,
    [ExpenseTypeDetailCode]       VARCHAR (8)    NULL,
    [ExpenseTypeDetailName]       NVARCHAR (100) NULL,
    [ExpenseTypeDetailOrderBy]    INT            DEFAULT ((2147483647)) NULL,
    [ExpenseDetailId]             INT            NULL,
    [ExpenseDetailCode]           VARCHAR (8)    NULL,
    [ExpenseDetailName]           NVARCHAR (100) NULL,
    [ExpenseDetailOrderBy]        INT            DEFAULT ((2147483647)) NULL,
    [FinanceExpenseDetailId]      INT            NULL,
    [FinanceExpenseDetailCode]    VARCHAR (8)    NULL,
    [FinanceExpenseDetailName]    NVARCHAR (100) NULL,
    [FinanceExpenseDetailOrderBy] INT            DEFAULT ((2147483647)) NULL,
    [ProjectExpenseDetailId]      INT            NULL,
    [ProjectExpenseDetailCode]    VARCHAR (8)    NULL,
    [ProjectExpenseDetailName]    NVARCHAR (100) NULL,
    [ProjectExpenseDetailOrderBy] INT            DEFAULT ((2147483647)) NULL,
    [SubAccountId]                INT            DEFAULT ((-1)) NULL,
    [SubAccountCode]              VARCHAR (8)    DEFAULT ('UNK') NULL,
    [SubAccountName]              NVARCHAR (100) DEFAULT ('Unknown') NULL,
    [SubAccountOrderBy]           INT            DEFAULT ((2147483647)) NULL,
    [RowChecksumMD5]              CHAR (36)      DEFAULT ('') NULL,
    [RowAuditId]                  INT            DEFAULT ((-1)) NOT NULL,
    PRIMARY KEY CLUSTERED ([AccountId] ASC) WITH (FILLFACTOR = 90, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF)
);

